<template>
	<view>
		<view class="view-image align-center justify-center flex">
			<u-upload :width="260" :height="180" :fileList="srcList" name="1" :maxCount="1" :previewFullImage="true"
				:deletable="false">
			</u-upload>
		</view>
		<uni-card class="view-title">
			<text class="uni-body view-content">资产编码: </text>
			<text class="uni-body view-content-right">{{asset.assetCode}}
			</text>
		</uni-card>

		<uni-card class="view-title">
			<text class="uni-body view-content">资产名称: </text>
			<text class="uni-body view-content-right">{{asset.assetName}}</text>
		</uni-card>

		<uni-card class="view-title">
			<text class="uni-body view-content">保管姓名:</text>
			<text class="uni-body view-content-right">{{asset.keepPerson == null ? '暂无': asset.keepPerson}}</text>
		</uni-card>

		<uni-card class="view-title">
			<text class="uni-body view-content">资产型号:</text>
			<text class="uni-body view-content-right">{{asset.assetModel}}</text>
		</uni-card>

		<uni-card class="view-title">
			<text class="uni-body view-content">所属公司:</text>
			<text class="uni-body view-content-right">{{asset.company}}</text>
		</uni-card>

		<uni-card class="view-title">
			<text class="uni-body view-content">所属部门:</text>
			<text class="uni-body view-content-right">{{asset.keepDeptName}}</text>
		</uni-card>

		<uni-card class="view-title">
			<text class="uni-body view-content">使用时间:</text>
			<text class="uni-body view-content-right">{{asset.useTime == null ? '暂无' : asset.useTime}}</text>
		</uni-card>

		<uni-card class="view-title">
			<text class="uni-body view-content">存放地点:</text>
			<text class="uni-body view-content-right">{{asset.liveAddress == null ? '暂无' : asset.liveAddress}}</text>
		</uni-card>

		<uni-card class="view-title">
			<text class="uni-body view-content">资产备注:</text>
			<text class="uni-body view-content-right">{{asset.remark == null ? '暂无' : asset.remark}}</text>
		</uni-card>

		<view style="text-align: center;padding-bottom: 20px;">
			<p>河南汉永集团</p>
			<p>河南省焦作市孟州市河阳办事处缑村北001号</p>
			<p>咨询热线：0391-8389000</p>
		</view>
	</view>
</template>

<script>
	import {
		getAsset
	} from '@/api/asset/asset.js'
	export default {
		data() {
			return {
				asset: '',
				srcList: [],
			}
		},
		onLoad: function(options) {
			let url = decodeURIComponent(options.q)
			let query = this.GetWxMiniProgramUrlParam(url);
			getAsset(query.assetId).then(response => {
				this.asset = response.data;
				this.srcList.push({
					"url": response.data.url
				});
			});
		},
		methods: {
			GetWxMiniProgramUrlParam(options) {
				let theRequest = {};
				if (options.indexOf("#") != -1) {
					const str = options.split("#")[1];
					const strs = str.split("&");
					for (let i = 0; i < strs.length; i++) {
						theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
					}
				} else if (options.indexOf("?") != -1) {
					const str = options.split("?")[1];
					const strs = str.split("&");
					for (let i = 0; i < strs.length; i++) {
						theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
					}
				}
				return theRequest;
			},
		}
	}
</script>

<style scoped>
	page {
		background-color: #ffffff;
	}

	.view-image {
		height: 543rpx;
		display: flex;
		box-sizing: border-box;
		position: relative;
		margin-left: 15%;
		margin-right: 15%;
		top: -46rpx
	}

	.view-title {
		font-weight: bold;
	}

	.view-content {
		font-size: 26rpx;
		padding: 12px 5px 0;
		color: #333;
		line-height: 30px;
	}

	.view-content-right {
		font-size: 32rpx;
		margin-left: 66px;
		font-weight: normal;
	}
</style>